<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */

namespace App\Site\Service;

use App\Site\Mapper\SiteInfoMapper;
use App\Site\Model\SiteInfo;
use App\Site\Service\Query\SiteInfoQuery;
use Deepwell\EasyQuery\Concern\QueryService;
use Mine\Abstracts\AbstractService;

/**
 * 租户管理服务类
 */
class SiteInfoService extends AbstractService
{
    use QueryService;

    /**
     * @var SiteInfoMapper
     */
    public $mapper;

    public function __construct(SiteInfoMapper $mapper)
    {
        $this->mapper = $mapper;
        $this->queryModelClassName = SiteInfo::class;
    }

    public function findByUuid(string $uuid): SiteInfo
    {
        $get = new SiteInfoQuery();
        $get->uuid = $uuid;
        return $this->queryOne($get);
    }

    public function findBySiteId(int|string $siteId): SiteInfo
    {
        $get = new SiteInfoQuery();
        $get->site_id = $siteId;
        return $this->queryOne($get);
    }
}